package com.hang.ad.vo;

import com.hang.ad.constant.CommonStatus;
import com.hang.ad.entity.AdCreative;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CreativeRequest {
    private String name;
    private Integer type;
    private Integer materialType;
    private Integer height;
    private Integer width;
    private Long size;
    private Integer duration;
    private Long userId;
    private String url;

    public AdCreative convert2Entity(){
        AdCreative adCreative = new AdCreative();
        BeanUtils.copyProperties(this, adCreative);
        adCreative.setAuditStatus(CommonStatus.VALID.getStatus());
        adCreative.setCreateTime(new Date());
        adCreative.setUpdateTime(adCreative.getCreateTime());

        return adCreative;
    }
}
